home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
TSRPARK.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-07-18
|
21KB
|
485 lines
PAGE 60,120
TITLE TSRPARK.ASM -- TesSeRact Demo program to park disk drive heads
;----------------------------------------------------------------------------
SUBTTL Originally TESSPARK.ASM : TesSeRact Revision Level 1
;-----------------------------------------------------------------------------
; TesSeRact(tm) -- A Library of Routines for Creating Ram-Resident (TSR)
; programs for the IBM PC and compatible Personal
; Computers.
;
;The software, documentation and source code are:
;
; Copyright (C) 1986, 1987, 1988 Tesseract Development Team
; All Rights Reserved
;
; c/o Chip Rabinowitz
; Innovative Data Concepts
; 2084 Woodlawn Avenue
; Glenside, PA 19038
; 1-215-884-3373
;
;-----------------------------------------------------------------------------
; This product supports the TesSeRact Standard for Ram-Resident Program
; Communication. For information about TesSeRact, contact the TesSeRact
; Development Team at:
; Compuserve: 70731,20
; MCIMAIL: 315-5415
; This MCIMAIL Account has been provided to the TesSeRact Development
; Team by Borland International, Inc. The TesSeRact Development Team
; is in no way associated with Borland International, Inc.
;-----------------------------------------------------------------------------
;
; BASED on code originally provided by Jim Mischel
;
; ORIGINAL COPYRIGHT NOTICE:
;
;;;; AUTOPARK.ASM - program to automatically park the disk drive heads
;;;; at specified time intervals.
;;;;
;;;; Copyright (c) 1988, Jim Mischel
;;;;
;;;; This program has been assembled using MASM 5.0. Changes may be required
;;;; for use with earlier versions.
;;;;
;;;;; TSRPARK.ASM - Rick Housh
;;;;;
;;;;; TSRPARK.ASM - Modifications to TESSPARK.ASM to allow variable timing
;;;;; intervals from 1 to 9 minutes for autopark with use of numerical
;;;;; parameter on command line, to support manual parking with use
;;;;; of hotkey, with popup when on DOS command line, detection of
;;;;; park failure on installation, and communication with the resident
;;;;; program to allow dynamically changing the elapsed time between
;;;;; automatic parks. Assembled using MASM 5.1.
;;;;;
;;;;; Everything is self-explanatory, except perhaps how to reset the
;;;;; timer when resident. Just enter ' TSRPARK # ', where # is any number
;;;;; of minutes between 1 and 9, and the new value will be inserted in the
;;;;; resident portion of the program. A message will confirm the change
;;;;; and even the MAPMEM display of residents will show the new value.
;;;;; Entering ' TSRPARK ' with no parameter will yield a confirming message
;;;;; if TSRPARK is resident, and an instructional message if it has not
;;;;; yet been installed. When the hotkey is pressed from the DOS prompt
;;;;; a message is displayed, in addition to the TESSBEEP sound. Inside
;;;;; a program, the sound will occur, but there will be no message.
;;;;;
;;;;; I have changed the "mysterious" headparking code somewhat, and tried
;;;;; to expand the comments to show how it really works. It's not that
;;;;; complicated, and does NOT care whether the computer is an AT or not,
;;;;; contrary to the comments in the original TESSPARK. I have also found
;;;;; an undocumented and useful function. Tch, tch. TSRCHECKRESIDENT
;;;;; returns the segment of the resident program in the es register if
;;;;; it has found the program installed in memory. The documentation
;;;;; only mentions a result returned in the ax register. I found this
;;;;; very useful, and have implemented in TSRPARK.
;;;;;
;;;;; TSRPARK Modifications of TESSPARK, Rick Housh, CIS 72466,212 - 7/18/1988
;;;;;
;;;;;
;;;;; To assemble this TesSeRact version:
;;;;;
;;;;; MASM TSRPARK;
;;;;; LINK TESS_ASM + TESS_BP + TSRPARK + TESS_END,TSRPARK;
;;;;; EXE2BIN TSRPARK.EXE TSRPARK.COM
;;;;;
.model small
.code
;
; Ticks2wait is # of timer ticks to wait between the last disk access
; and parking the disk. There are approximately 18.2 ticks per second.
;
; Maximum possible ticks2wait is 65536 ticks, very close to 1 hour.
; Limit with this configuration is 9828 (9 minutes).
;
ticks_min equ 1092 ;Number of timer ticks in 1 minute
tinkle equ 1 ;Sound TESSBEEP if set
;set tinkle to 0
;for no sound
tick_count dw ? ;Current count
ticks2wait dw ? ;Ticks to wait: 1092 = 1 minute
;
; The parkit routine attempts to park all hard disks.
; Returns with carry set if park was unsuccessful.
;
parkit proc near
mov si,0080h ;Hard drive id nos. start at 80h
pk0: mov ah,08h ;Function gets drive parms.
mov dx,si ;DX is drive ID No.
int 13h ;Get drive parms, dl = No. of drives
jc pkdone ;Error if carry, jump out
xor dh,dh ;Don't need max head-side number
mov di,dx ;Save drive count from dl to di
cmp di,01h ;Is there at least one?
jb pkdone ;If no hard drives, exit
add di,7fh ;Convert drive no. to drive id no.
inc ch ;CH is now tracks + 1
jnb pk1
add cl,40h ;CL is sectors
pk1: mov ax,0c01h ;seek to cylinder
mov dx,si ;DX is drive ID
int 13h ;this does the seek
inc si ;bump drive count
cmp si,di ;Was it the last? No? Then
jbe pk0 ;loop until all drives are parked
pkdone:
if tinkle
EXTRN TESSBEEP:NEAR
call TESSBEEP
endif
ret
parkit endp
;
; TesSeRact Entry Points
;
;
PUBLIC TSRUSERPROC, TSRTIMERPROC, TSRBACKCHECK, TSRMAIN, TSRBACKPROC
PUBLIC TSRCLEANUP
;
; TSUSERPROC is a NULL procedure. We don't service it in this program.
;
;
TSRUSERPROC: ;Return, does nothing
ret
int13ptr dw 0 ;Saved location of INT 13 flag
; from TesSeRact data area
do_park db 0 ;Flag set to 1 when wish to park
TSRminutes db " " ;Holds minutes between parks in ASCII
park_msg label near ;Message to display when popped up
; AND at DOS prompt
db 13,10,10
db 'TSRPark has manually parked the hard disk(s)',13,10
db 'as requested. Will automatically repark in ',13,10
db ' minute(s) after next disk access. ',13
msg_len dw $ - park_msg
reset_it proc near
mov do_park,0 ;Say not to park
mov bx,[int13ptr] ;Get INT13 flag
mov byte ptr [bx],0 ;and turn off because
;parking isn't using.
mov ax,[ticks2wait] ;Use our timer to
mov [tick_count],ax ;restart wait.
ret
reset_it endp
TSRBACKCHECK proc near
assume cs:_TEXT, ds:_TEXT
mov al,do_park ;Put flag in ax
xor ah,ah ;if non-zero, call TSRBACKPROC
ret
TSRBACKCHECK endp
TSRBACKPROC proc near
assume cs:_TEXT, ds:_TEXT
call parkit ;Attempt to park it
call reset_it ;and reset everything
ret
TSRBACKPROC endp
TSRMAIN proc near
assume cs:_TEXT, ds:_TEXT
;On hotkey
call parkit ;P